package com.zengqingfa.juc.n4;

/**
 * @author zengqingfa
 * @className Immutable
 * @description
 * @create 2021/6/10 23:10
 */
public class Immutable {

    private int value = 0;

    public Immutable(int value) {
        this.value = value;
    }

    public int getValue() {
        return this.value;
    }

    /**
     * 增加某个值
     *
     * @param x
     * @return
     */
    public Immutable add(int x) {
        return new Immutable(this.value + x);
    }
}